<?php

/**
 * @developer socheat 
 * @copyright 2012
 */
    $report = mysql_query("SELECT * FROM counter
            INNER JOIN tblproduct AS pro ON pro.`id`=counter.`pd_id`
            WHERE by_user='".$_SESSION['acc_id']."'  LIMIT 5");
     // new email       
    $email_n        = mysql_query("SELECT * FROM contact WHERE to_user='".$_SESSION['username']."' AND STATUS=0");
    $mail_rows      = mysql_num_rows($email_n);   
            
            
// personal page seller
    $strin          ="";
    $st             = $_SESSION['acc_id'];    
    $company        = new company();
    $company        ->getcompany($strin,$st);    
// end personal page seller

// last post
    $sts            = "owner='".$_SESSION['acc_id']."' ORDER BY id DESC LIMIT 0,5";    
    $product        = new prodcut_tb(); 
   $GetAll          = $product ->product_list($sts);    
// end last post

// count post
    $pro_count      = "owner='".$_SESSION['acc_id']."'";    
    $product        = new prodcut_tb(); 
    $procount        = $product ->product_list($sts);
    $num_rows = mysql_num_rows($procount);       
// end count post            
?>

	<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
	<style>
    .toggler
    {
        margin: 10px 0 0 0;
    }
	.button {		
		text-decoration: none;        
	}
    .point
    {
        cursor: pointer;
    }
	#effect {
		position: relative;
		padding: 0.4em;
	}
	#effect h3 {
		margin: 0;
		padding: 0.4em;
		text-align: center;
        font-size: 14px;
        display:block;
	}
    .t_none
    {
        border:none;
    }
	</style>
	<script>
	$(function() {
		// run the currently selected effect

        $(".button").click(function () {
        $(".table_views").toggle("slideUp");
        });
        
        $(".button_last").click(function () {
        $(".table_last").toggle("fast");
        }); 
        
        $(".button_top").click(function () {
        $(".table_top").toggle("fast");
        });    

	});
	</script>
 <!--right now-->
 <div class="toggler">
	<div id="effect" class="ui-widget-content ui-corner-all">
        <h3 class="button point ui-widget-header ui-corner-all">Right Now</h3>
			<table class="table_views t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="center" valign="middle">New Email:</td>
                <td class="right" valign="middle"><a href="<?php echo W_ROOT;?>/seller/product/">(<strong><span style="color: #ff0000;"><?php echo $mail_rows;?></span></strong>) inbox</a></td>
              </tr>
              <tr>
                <td align="center" valign="middle">Page views:</td>
                <td class="right" valign="middle"><?php echo $company->views;?></td>
              </tr>
              <tr>
                <td align="center" valign="middle">Content:</td>
                <td class="right" valign="middle"><a href="<?php echo W_ROOT;?>/seller/product/"><strong><?php echo $num_rows;?></strong> Products</a></td>
              </tr>
            </table>
	</div>
</div>
<!--end right now-->    

<!--last article-->    
<div class="toggler">
	<div id="effect" class="ui-widget-content ui-corner-all">
		<h3 class="button_last point ui-widget-header ui-corner-all">Last 5 Added Articles</h3>    
<table style="display: none;" class="table_last t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="middle"><strong>ID</strong></td>
    <td align="center" valign="middle"><strong>Product name</strong></td>
  </tr>

<?php   
    $i=1;         
        while($ros = mysql_fetch_array($GetAll)){ 
            $i++;
            ?>
          <tr>
    <td><?php echo $ros['id'];?></td>
    <td><?php echo $ros['product_name'];?></td>
  </tr>        
<?php    
    }    
?>

</table>
	</div>
</div>
<!--end last article--> 

    
<!--top article-->    
<div class="toggler">
	<div id="effect" class="ui-widget-content ui-corner-all">
		<h3 class="button_top point ui-widget-header ui-corner-all">Top 5 Popular Articles</h3>    
<table style="display: none;" class="table_top t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="9%" align="center" valign="middle"><strong>ID</strong></td>
    <td width="74%" align="center" valign="middle"><strong>Product name</strong></td>
    <td width="17%" align="center" valign="middle"><strong>Hits</strong></td>
  </tr>

<?php   
    $i=1;         
        while($report_get = mysql_fetch_assoc($report))
        {
            $i++;
            ?>
          <tr>
    <td><?php echo $report_get['id'];?></td>
    <td><?php echo $report_get['product_name'];?></td>
    <td><?php echo $report_get['top_view'];?></td>
  </tr>        
<?php    
    }    
?>

</table>
	</div>
</div>
<!--end top article--> 